<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<style>
    .layui-fluid {
        padding: 0px;
    }

    .align-center {
        text-align: center;
    }

    .none_border td {
        border-left: none;
        border-right: none;
    }
</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div id="print_delivery"></div>
                <script id="print_delivery_tpl" type="text/html">
                    <div class="layui-text">
                        <button type="button" class="layui-btn layui-btn-sm" lay-filter="print_delivery">打印</button>
                    </div>
                    <div class="layui-tab-item layui-show" id="print_delivery_list">
                        {{# layui.each(d, function(index, tmp){ }}
                        {{ tmp.content }}
                        <br>
                        {{# }); }}
                    </div>
                    <div class="layui-text">
                        <button type="button" class="layui-btn layui-btn-sm" lay-filter="print_delivery">打印</button>
                    </div>
                </script>

            </div>
        </div>
    </div>
</div>
<script src="../../../../layuiadmin/layui/layui.js"></script>
<script src="../../../../layuiadmin/lib/print.js"></script>
<script>
    layui.config({
        base: '../../../../layuiadmin/',//静态资源所在路径
        version: true
    }).extend({
        index: 'modules/admin/index',//主入口模块
    }).use(['index', 'common'], function () {
        let $ = layui.$,
            laytpl = layui.laytpl,
            common = layui.common,
            model_url = '/order/order';

        common.set_model_url(model_url);//设置默认模块地址
        let id = common.get_query_variable('id');

        //详情
        function print_delivery() {
            let result = common.ajax(model_url + '/print_delivery', {id: id.split(',')})
            if (result) {
                laytpl($('#print_delivery_tpl').html()).render(result.data, function (html) {
                    $('#print_delivery').html(html);
                })
            }
        }

        print_delivery();

        //打印
        $('body').on('click', '[type="button"]', function () {
            let filter = $(this).attr('lay-filter');
            if (filter == 'print_delivery') {
                Print('#print_delivery_list')
            }
        })
    });
</script>
</body>
</html>
